﻿<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id="NGPT.ItemLevelApproval.Action"
    Location="CommandUI.Ribbon.DisplayForm"
    RegistrationType="ContentType"
    RegistrationId="0x01">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.ListForm.Display.Actions.Controls._children">
          <Button Id="NGPT.ItemLevelApproval.Button"
                  Command="NGPT.ItemLevelApproval.Button.Command"
                  Image16by16="/_layouts/NG/Images/Conversation16.png"
                  Image32by32="/_layouts/NG/Images/Conversation32.png"
                  LabelText="Approve It!"
                  Sequence="15"
                  TemplateAlias="o1" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
          Command="NGPT.ItemLevelApproval.Button.Command"
          CommandAction="javascript:
                            var dialogOptions = {
                              url: '/_layouts/NGPT/ApproveIt.aspx?SiteUrl=' + encodeURIComponent('{SiteUrl}') + '&amp;ListId={ListId}&amp;ItemId={ItemId}',
                              title: 'Approve It!',
                              allowMaximize: true,
                              showClose: true,
                              width:500,
                              height:350
                            };
                            SP.UI.ModalDialog.showModalDialog(dialogOptions); " 
          EnabledScript="javascript:function CheckItemExists()
                    {
                      return /[?&amp;]ID=/.test(location.href);
                    }
                    CheckItemExists();" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
  <CustomAction
    Id="NGPT.ItemLevelApproval.Action"
    Location="CommandUI.Ribbon.EditForm"
    RegistrationType="ContentType"
    RegistrationId="0x01">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.ListForm.Edit.Actions.Controls._children">
          <Button Id="NGPT.ItemLevelApproval.Button"
                  Command="NGPT.ItemLevelApproval.Button.Command"
                  Image16by16="/_layouts/NG/Images/Conversation16.png"
                  Image32by32="/_layouts/NG/Images/Conversation32.png"
                  LabelText="Approve It!"
                  Sequence="15"
                  TemplateAlias="o1" />
        </CommandUIDefinition>
        <CommandUIDefinition
            Location="Ribbon.DocLibListForm.Edit.Actions.Controls._children">
          <Button Id="NGPT.ItemLevelApproval.Button"
                  Command="NGPT.ItemLevelApproval.Button.Command"
                  Image16by16="/_layouts/NG/Images/Conversation16.png"
                  Image32by32="/_layouts/NG/Images/Conversation32.png"
                  LabelText="Approve It!"
                  Sequence="15"
                  TemplateAlias="o1" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
          Command="NGPT.ItemLevelApproval.Button.Command"
          CommandAction="javascript:
                            var dialogOptions = {
                              url: '/_layouts/NGPT/ApproveIt.aspx?SiteUrl=' + encodeURIComponent('{SiteUrl}') + '&amp;ListId={ListId}&amp;ItemId={ItemId}',
                              title: 'Approve It!',
                              allowMaximize: true,
                              showClose: true,
                              width:500,
                              height:350
                            };
                            SP.UI.ModalDialog.showModalDialog(dialogOptions); " 
           EnabledScript="javascript:function CheckItemExists()
                    {
                      return /[?&amp;]ID=/.test(location.href);
                    }
                    CheckItemExists();" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>




